class colorGui {
    __New() {
        this.addGui()
    }
    ; 创建GUI
    addGui() {
        this.gui := Gui(, "技能取色")
        this.gui.SetFont("s11", "微软雅黑")
        this.skill := this.gui.Add("Text", "x10 w85 vskill", "")
        this.gui.Add("Text", "y+12", "X坐标：")
        this.colorX := this.gui.Add("Edit", "ReadOnly w85 x+10 vcolorX -Tabstop Center")
        this.gui.Add("Text", "x10 y+8", "Y坐标：")
        this.colorY := this.gui.Add("Edit", "ReadOnly w85 x+10 vcolorY -Tabstop Center")
        this.gui.Add("Text", "x10 y+8", "色  值：")
        this.colorValue := this.gui.Add("Edit", "ReadOnly w85 x+10 vcolorValue -Tabstop Center")
        this.gui.Add("Text", "x10 y+8", "容  差：")
        this.colorT := this.gui.Add("Edit", "ReadOnly w85 x+10 vcolorT -Tabstop Center", "8")

        this.gui.Add("Text", "ReadOnly ys", "取色参考：")
        this.skillPic := this.gui.Add("Pic", "y+8 w150 h150 Border vskillPic")
        this.gui.Add("Text", "x10 y+18", "取色说明：`nF2：截图取色`nESC键：取消取色`n回车键：确认取色`n截图取色过程中可用小键盘的↑↓→←四个方`n向键进行微调")
        this.gui.Add("Text", "x10 y+ vtextNote")
        this.btnColorSave := this.gui.Add("Button", "x10 y+18 vbtnColorSave", "确认")
        this.gui.Add("Button", "x+10 vbtnReset", "重置")
        this.gui.Opt("AlwaysOnTop +Owner +E0x20")

        this.gui.OnEvent("Close", (*) => mainGuiShoworHide())
        this.btnColorSave.OnEvent("Click", (*) => this.getColorValue())
    }
    showGui() {
        if (this.gui == "") {
            this.addGui()
            this.gui.show("x10 y10")
        } else {
            this.gui.show("x10 y10")
        }
    }
    Destroy() {
        this.gui.Destroy()
        this.gui := ""
    }
    Hwnd {
        get => this.gui.Hwnd
    }
    ; 保存按钮事件
    colorSaveEvent(callback) {
        this("btnColorSave").OnEvent("Click", callback)
    }
    ; 重置按钮事件
    colorResetEvent(callback) {
        this("btnReset").OnEvent("Click", callback)
    }
    ; 取色时使用，根据职业名称，获取技能取色数据至表格中
    getColorValue(*) {
        global rowNum, careerData
        data := this.colorX.Text "," this.colorY.Text "," this.colorValue.Text "," this.colorT.Text
        careerData.lv.Modify(rowNum, "Col4", data)
        careerData.lv.ModifyCol(4)
        mainGuiShoworHide()
    }
}